package com.itheima.springboottilasmanager.pojo.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDate;
import java.time.LocalDateTime;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class Clazz {
    private Integer id; //ID
    private String name; //班级名称
    private String room; //班级教室
    private LocalDate beginDate; //开课时间
    private LocalDate endDate; //结课时间
    private Integer masterId; //班主任
    private Integer subject; //学科
    private LocalDateTime createTime; //创建时间
    private LocalDateTime updateTime; //修改时间
   @TableField(exist = false)
    private String status;

   @TableField(exist = false)
    private  String masterName;
    public void panduan() {
        if (beginDate != null && endDate != null) {
            if (beginDate.isBefore(LocalDate.now()) && endDate.isBefore(LocalDate.now())) {
                status = "结课";
            } else if (beginDate.isAfter(LocalDate.now())) {
                status = "未开班";
            } else {
                status = "进行中";
            }
        } else {
            status = "日期未设置"; // 或者根据业务逻辑做处理
        }
    }



}

